#include <stdio.h>
#include <stdlib.h>
#include <time.h>
#include <getopt.h>
#define data_type double

struct option opt_options[] = {
    {"row", required_argument, NULL, 'n'},
    {"column", required_argument, NULL, 'm'},
    {"matrix", no_argument, NULL, 0},
    {"vector", no_argument, NULL, 0},
    {"help", no_argument, NULL, 'h'},
    {NULL, no_argument, NULL, 0}
};

int main(int argc, char** argv) {
    srand(time(NULL));
    int n, m;
    n = atoi(argv[1]);
    m = atoi(argv[2]);
    data_type* matrix = malloc(n * m * sizeof(data_type));
    data_type* vec = malloc(m * sizeof(data_type));

    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            matrix[i * m + j] = ((data_type)(rand() % 8096)) / 1000.0;
        }
    }
    for (int i = 0; i < m; ++i) {
        vec[i] = ((data_type)(rand() % 8096)) / 1000.0;
    }

    FILE* f = fopen("out.txt", "w");
    fprintf(f, "%d %d\n", n, m);
    for (int i = 0; i < n; ++i) {
        for (int j = 0; j < m; ++j) {
            fprintf(f, "%f ", matrix[i * m + j]);
        }
        fprintf(f, "\n");
    }
    fprintf(f, "\n");
    for (int i = 0; i < m; ++i) {
        fprintf(f, "%f ", vec[i]);
    }
    fprintf(f, "\n");
    fclose(f);

    free(matrix);
    free(vec);
    return 0;
}
